class BlogSort < ActiveRecord::Base
  validates :sort_name, :admin_user_id, presence: true
  
  validates :sort_name,
            length: {maximum: 20}

  has_many :posts,
           inverse_of: :blog_sort,
            dependent: :nullify

  belongs_to :admin_user, :class_name => 'Admin::User',   #默认外键名：user_id
              inverse_of: :blog_sorts
  resourcify
end
